home *** CD-ROM | disk | FTP | other *** search
/ Click Press Kit / Click Press Kit.iso / pc / main.dxr / Internal_26_Sound Parent.ls < prev    next >
Encoding:
Text File  |  2006-05-31  |  2.6 KB  |  110 lines

  1. property pBGSoundStatus, pButtonStatus, pBGSoundMember, pBGSoundLooped, pBGSoundChannel, pButtonSoundMember, pButtonSoundChannel, pVolume, pRealVolume
  2. global gSound, gVideo
  3.  
  4. on new me
  5.   pBGSoundStatus = "false"
  6.   pButtonStatus = "false"
  7.   pBGSoundMember = EMPTY
  8.   pBGSoundLooped = EMPTY
  9.   pButtonSoundMember = EMPTY
  10.   pBGSoundChannel = 0
  11.   pButtonSoundChannel = 0
  12.   pVolume = 100
  13.   pRealVolume = 0
  14.   return me
  15. end
  16.  
  17. on mStopSound me
  18.   sound(pBGSoundChannel).stop()
  19.   gSound.pBGSoundStatus = "FALSE"
  20.   pRealVolume = 0
  21. end
  22.  
  23. on mStopSoundTrailer me
  24.   sound(pBGSoundChannel).stop()
  25.   pRealVolume = 0
  26. end
  27.  
  28. on mStopSoundButton me
  29.   sound(pButtonSoundChannel).stop()
  30. end
  31.  
  32. on mSetVolume me, vString
  33.   case vString of
  34.     "volume25":
  35.       pVolume = 25
  36.       sound(pBGSoundChannel).volume = 255 * 0.25
  37.       pRealVolume = 255 * 0.25
  38.     "volume50":
  39.       pVolume = 50
  40.       sound(pBGSoundChannel).volume = 255 * 0.5
  41.       pRealVolume = 255 * 0.5
  42.     "volume75":
  43.       pVolume = 75
  44.       sound(pBGSoundChannel).volume = 255 * 0.75
  45.       pRealVolume = 255 * 0.75
  46.     "volume100":
  47.       pVolume = 100
  48.       sound(pBGSoundChannel).volume = 255
  49.       pRealVolume = 255
  50.   end case
  51. end
  52.  
  53. on mPlaySound me
  54.   gSound.pBGSoundStatus = "TRUE"
  55.   if sound(pBGSoundChannel).isBusy() then
  56.     exit
  57.   end if
  58.   puppetSound(pBGSoundChannel, member(pBGSoundMember))
  59.   case gSound.pVolume of
  60.     0:
  61.       sound(pBGSoundChannel).volume = 0
  62.       gVideo.pVideoVolume = 0
  63.       pRealVolume = 0
  64.     25:
  65.       sound(pBGSoundChannel).volume = 255 * 0.25
  66.       gVideo.pVideoVolume = 255 * 0.25
  67.       pRealVolume = 255 * 0.25
  68.     50:
  69.       sound(pBGSoundChannel).volume = 255 * 0.5
  70.       gVideo.pVideoVolume = 255 * 0.5
  71.       pRealVolume = 255 * 0.5
  72.     75:
  73.       sound(pBGSoundChannel).volume = 255 * 0.75
  74.       gVideo.pVideoVolume = 255 * 0.75
  75.       pRealVolume = 255 * 0.75
  76.     100:
  77.       sound(pBGSoundChannel).volume = 255
  78.       gVideo.pVideoVolume = 255
  79.       pRealVolume = 255
  80.   end case
  81. end
  82.  
  83. on mResumeSound me
  84.   if pBGSoundStatus = "false" then
  85.     gSound.mStopSound()
  86.     exit
  87.   end if
  88.   if sound(pBGSoundChannel).isBusy() then
  89.     exit
  90.   end if
  91.   if gSound.pRealVolume <> gVideo.pVideoVolume then
  92.     sound(pBGSoundChannel).volume = gVideo.pVideoVolume
  93.   end if
  94.   puppetSound(pBGSoundChannel, member(pBGSoundMember))
  95. end
  96.  
  97. on mPlayButtonClick me
  98.   if pButtonStatus = "false" then
  99.     gSound.mStopSoundButton()
  100.     exit
  101.   end if
  102.   if sound(pButtonSoundChannel).isBusy() then
  103.     exit
  104.   end if
  105.   if gSound.pRealVolume <> gVideo.pVideoVolume then
  106.     sound(pButtonSoundChannel).volume = gVideo.pVideoVolume
  107.   end if
  108.   puppetSound(pButtonSoundChannel, member(pButtonSoundMember))
  109. end
  110.